#ifndef optimize_h
#define optimize_h

#define ARRAY_TYPE_LINEAR 1
#define ARRAY_TYPE_GRID 2
#define ARRAY_TYPE_CIRCLE 3
#define ARRAY_TYPE_CIRCLE_CENTER 4

#define PLOT_TYPE_SCREEN 1
#define PLOT_TYPE_IMAGE 2

// n:           number of elements
// x:           x coordinates
// y:           y coordinates
// wavelength:  wavelength in units the same as dimension1
// theta:       look angle in degrees: 90 means broadside, 0 means end-fire
// result:      complex element currents
// directivity: pointer to directivity result
int OptimizeArray(int n, double x[], double y[], double wavelength, double theta, complex result[], double *directivity);

// n:           number of elements in first dimension
// m:           number of elements in second dimension
// type:        either grid, linear, circle, or circle and center
// dimension1:  1st linear spacing or 1st circle radius
// dimension2:  2nd linear spacing or 2nd circle radius
// x:           result x coordinates
// y:           result y coordinates
int CreateArray(int n, int m, int type, double dimension1, double dimension2, double x[], double y[]);

// name:        short name to use on the legend
// type:        screen or PNG image
// n:           number of elements
// wavelength:  wavelength in units same as coordinates
// positions:   array of n pairs of element coordinates
// currents:    array of n complex (magnitude and phase) of feed currents

int PlotArray(char *name, int type, int n, double wavelength, double x[], double y[], double C[], double A[]);
#endif
